package com.itheima.utils;

import java.sql.Connection;

/**
 * @author huyoufu <https://github.com/huyoufu>
 * @TIME 2020-08-09 11:12
 * @description
 */
public class DatasourceUtil {
    //这就是一个负责帮助我们往线程放置和获取放置对象的一个工具人!!
    private static ThreadLocal<Connection> connectionThreadLocal=new ThreadLocal<>();

    public static void setConnection(Connection connection){
        //放到线程中去了!!

        connectionThreadLocal.set(connection);
    }

    public static Connection getConnection(){
        return connectionThreadLocal.get();
    }

}
